package com.apes.enquiry.supplier.baturu.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = BaturuInquireSupplier.CONST_TABLE_NAME)
public class BaturuInquireSupplier extends BaseModel {
    public static final String CONST_TABLE_NAME = "sp_buturu_inquire_supplier";

    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "巴图鲁-询价结果")
    @Comment("编号")
    private String id;

    @Comment("询价结果编码")
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "baturu_inquire_result_id", referencedColumnName = "id")
    private BaturuInquireResult baturuInquireResult;

    @Comment("报价编号")
    @Column(name = "price_no", length = 60)
    private String priceNo;

    @Comment("供应商编码")
    @Column(name = "supplier_id")
    private Long supplierId;

    @Comment("实际价格")
    @Column(name = "quote_price", columnDefinition = ApesConst.FIELD_16_4_0)
    private BigDecimal quotePrice;

//    @Comment("优惠价格")
//    @Column(name = "quote_price_with_discount", columnDefinition = ApesConst.FIELD_16_4_0)
//    private double quotePriceWithDiscount = 0;

    @Comment("配件品质")
    @Column(name = "factory_type", length = 60)
    private int factoryType;

    @Comment("配件品牌")
    @Column(name = "brand_name", length = 60)
    private String brandName;

    @Comment("配件产地")
    @Column(name = "origin_place", length = 60)
    private String originPlace;

    @Comment("质保期")
    @Column(name = "guarantee_period", columnDefinition =  "number(3, 1) default 0")
    private float guaranteePeriod = 0.0f;

    @Comment("配件图片的url集合")
    @Column(name = "supplier_pictures")
    private String supplierPictures;

    @Comment("报价备注")
    @Column(name = "remark")
    private String remark;


    /*-------------------------发货信息------------------------------*/
    @Comment("发货地")
    @Column(name = "delivery_place")
    private String deliveryPlace;

    @Comment("预计送达时间")
    @Column(name = "arrive_time")
    private String arriveTime;

    @Comment("发货安排")
    @Column(name = "supplier_shipped_plan")
    private String supplierShippedPlan;

    /*----------------------------订货信息---------------------------*/

    @Column(name = "book_goods", columnDefinition = "number(1,0) default 0")
    @Comment("是否订货")
    private boolean bookGoods = false;

    @Comment("订货需要的工作日")
    @Column(name = "book_goods_days", columnDefinition = "number(2,0) default 0")
    private int bookGoodsDays;

    @Comment("是否支持退货")
    @Column(name = "returnable", columnDefinition = "number(1,0) default 0")
    private boolean returnable = false;

    /*-------------------------------------------------------*/
}
